package com.ysw.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

/**
 * @ClassName ConsumerDemo
 * @Description TODO
 * @Author ysw
 * @Date 2021/12/12 17:21
 */
@Component
public class ConsumerDemo {
    @KafkaListener(topics = "my-topic1",groupId = "MyGroup1")
    public void listenGroup(ConsumerRecord<String,String> record, Acknowledgment ack){
        String value = record.value();
        System.out.println(record);
        System.out.println(value);
        ack.acknowledge();
    }
}